	#include "Gk.h"

namespace gk
{
	void DeviceCommon::InitialisePlatform(InitParamsHandle hInitParams)
	{
		m_initParams = *hInitParams;

		// Initialise platform
		pf::InitParams pfInitParams;
		pfInitParams.m_hDisplayConfigSelector	= hInitParams->m_hDisplayConfigSelector;
		pfInitParams.m_szTitle					= hInitParams->m_szTitle;
		pfInitParams.m_startVisible				= hInitParams->m_startVisible;

		pf::Initialise(pfInitParams);

		m_hDisplayConfig = pf::GetPlatform()->GetDisplayConfig();
	}

	void DeviceCommon::InitialiseCommon(InitParamsHandle /*hInitParams*/)
	{
		// Create system context
		m_systemContext.m_type = ContextType::Immediate;
		CreateContext(m_systemContext);
	}

	void DeviceCommon::ShutdownPlatform()
	{
		pf::Shutdown();
	}

	void DeviceCommon::ShutdownCommon()
	{
		ReleaseContext(m_systemContext);
	}

	bool DeviceCommon::Present()
	{
		return pf::GetPlatform()->Present();
	}
}